﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Help;
using Model;
using Bll;

namespace Myproject.BSM.Ashx.PcBase
{
    /// <summary>
    /// SlideSelect 的摘要说明
    /// </summary>
    public class SlideSelect : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            if (!string.IsNullOrEmpty(cookieHelp.AdminId))
            {
                if (new AdminBLL().ExistsByAdminName(cookieHelp.AdminName) && new AdminBLL().ExistsByAdminId(cookieHelp.AdminId))
                {
                    string id = context.Request.Form["pc_base_slideselect_ID"];
                    string slideid = context.Request.Form["pc_base_slideselect_slideID"];
                    if (id != "0")
                    {
                        if (new ConfigBLL().Update(Int32.Parse(id), slideid))
                        {
                            context.Response.Write(ReturnJsonHelp.BJUIajaxJson(200, "操作成功！", "pc_base_slide", "", "", true, "", ""));
                        }
                        else
                        {
                            context.Response.Write(ReturnJsonHelp.BJUIajaxJson(300, "操作失败！", "pc_base_slide", "", "", true, "", ""));
                        }
                    }
                    else
                    {
                        context.Response.Write(ReturnJsonHelp.BJUIajaxJson(300, "操作失败！", "pc_base_slide", "", "", true, "", ""));
                    }
                }
                else
                {
                    context.Response.Write(ReturnJsonHelp.BJUIajaxJson(301, "登陆超时！", "", "", "", false, "/bsm/logFrom.aspx", "登陆超时！"));
                }
            }
            else
            {
                context.Response.Write(ReturnJsonHelp.BJUIajaxJson(301, "登陆超时！", "", "", "", false, "/bsm/logFrom.aspx", "登陆超时！"));
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}